


//1.
function inputFocus(sel){
	var $input = $(sel+' input');
	$input.focusin(function(){
		$(this).css('border-color','#00a0e9');
		$(this).addClass('active');
	});
	$input.focusout(function(){
		$(this).css('border-color','');
		$(this).removeClass('active');
	});
}











//window高度
//var windowHeight = $(window).innerHeight();
//$('input[type="text"]').on('focus',function(){
//	var _this = $(this);
//	alert(333);
////	$(window).on('resize',function(){
////		var viewHeight = $(window).innerHeight();
////		var $main = $('.main');
////		
////		var scroll = _this.offset().top + viewHeight*0.5;
////		$main.animate({
////			scrollTop:scroll
////		},200);
//////		alert(windowHeight+','+viewHeight+','+scroll);
////	});
//});





var scroll_timer = null;
inputscroll();
function inputscroll(){
	$('input').on('focus',function(){
		var _this = this;
		scroll_timer = setTimeout(function(){
			_this.scrollIntoViewIfNeeded();
			clearTimeout(scroll_timer);
		},0);
	});
}




//倒计时方法
function countDown(deadline){
    var $hour =  $('.main-timer .timer .hour'),
    	$min =  $('.main-timer .timer .min'),
    	$second =  $('.main-timer .timer .second');
    var endTime = new Date(deadline * 1000).getTime();

    var hour,min,sec,count,time;

    var timer = setInterval(function () {
        time = endTime  - new Date().getTime();

        //超期未参与
        if(time<0){
            $('.main-timer').remove();
            clearInterval(timer);
            return;
        }

        hour=Math.floor(time/1000/60/60%24);
        min=Math.floor(time/1000/60%60);
        sec=Math.floor(time/1000%60);

        if (hour < 10) {
            hour = "0" + hour;
        }
        if (min < 10) {
            min = "0" + min;
        }
        if (sec < 10) {
            sec = "0" + sec;
        }

        $hour.text(hour);
        $min.text(min);
        $second.text(sec);
    },1000);
}